package com.sharp.kernel.mybatis.dao.repository;

import com.sharp.kernel.mybatis.dao.entity.Columns;
import com.sharp.kernel.mybatis.dao.mapper.ColumnsMapper;
import com.sharp.kernel.mybatis.repository.BaseSqlRepository;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.List;

/**
 * Title: ColumnsService
 * Description: Copyright: Copyright (c) 2022 Company: Sharp Ltd.
 *
 * @author Sharp
 * @date 2022/09/26 23:28
 */
@Service
public class ColumnsService extends BaseSqlRepository<Columns, ColumnsMapper> {

    @Resource
    private ColumnsMapper columnsMapper;

    public List<Columns> getColumns(String sqlDbName, String sqlTableName) {
        Example example = super.getExample();
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("tableSchema", sqlDbName);
        criteria.andEqualTo("tableName", sqlTableName);
        return super.select(example);
    }
}
